<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css"/>
    <link href="lib/layui-v2.5.6/layui/css/layui.css" rel="stylesheet" type="text/css">
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>删除的用户</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span
        class="c-gray en">&gt;</span> 删除的用户<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                              href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="text-c"> 日期范围：
        <input type="text" onfocus="WdatePicker({ maxDate:'#F{$dp.$D(\'datemax\')||\'%y-%M-%d\'}' })" id="datemin"
               class="input-text Wdate" style="width:120px;">
        -
        <input type="text" onfocus="WdatePicker({ minDate:'#F{$dp.$D(\'datemin\')}',maxDate:'%y-%M-%d' })" id="datemax"
               class="input-text Wdate" style="width:120px;">
        <input type="text" class="input-text" style="width:250px" placeholder="输入会员名称、电话、邮箱">
        <button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜用户
        </button>
    </div>
    <div class="mt-20">
        <table id="member-del-list" lay-filter="member-del-list-filter"></table>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript" src="lib/layui-v2.5.6/layui/layui.js"></script>
<script type="text/html" id="tool">
    <div class="layuibtn-container">
        <button class="layui-btn layui-btn-sm" lay-event="delete">删除</button>
    </div>
</script>
<script>
    var tableId;
    var layer;
    var memberIds = [];
    $(document).ready(function () {
        layui.use('table', function () {
            var table = layui.table;

            //第一个实例
            tableId = table.render({
                elem: '#member-del-list'
                , url: '/Olala/client/customer/customerInfoPageDel' //数据接口
                , page: true //开启分页
                , response: {
                    statusCode: 20
                }
                , toolbar: "#tool"
                , method: "post"
                , cols: [
                    [ //表头
                        {field: "checkbox", title: "选择", type: "checkbox", width: "5%"},
                        {field: "customerInfId", title: "编号", width: "4%"},
                        {field: "customerName", title: "用户名", width: "7%"},
                        {field: "realName", title: "真实姓名", width: "5%"},
                        {
                            field: "identyCardType", title: "证件类型", width: "5%",
                            templet: function (data) {
                                switch (data.identyCardType) {
                                    case 1:
                                        return "身份证";
                                    case 2:
                                        return "军官证";
                                    case 3:
                                        return "护照";
                                }
                            }
                        },
                        {field: "identyCardNo", title: "证件号码", width: "12%"},
                        {field: "userMobile", title: "手机号", width: "8%"},
                        {field: "email", title: "邮箱", width: "10%"},
                        {
                            field: "gender", title: "性别", width: "5%",
                            templet: function (data) {
                                return data.gender === 0 ? "保密" : data.gender === 1 ? "女" : "男";
                            }
                        },
                        {
                            field: "customerStatus", title: "状态", width: "5%",
                            templet: function (data) {
                                return data.customerStatus === 0 ? "禁用" : "启用";
                            }
                        },
                        {
                            field: "customerLevel", title: "级别", width: "8%",
                            templet: function (data) {
                                switch (data.customerLevel) {
                                    case 1:
                                        return "普通会员";
                                    case 2:
                                        return "青铜";
                                    case 3:
                                        return "白银";
                                    case 4:
                                        return "黄金";
                                    case 5:
                                        return "钻石";
                                }
                            }
                        },
                        {field: "registerTime", title: "注册时间", width: "11%"},
                        {field: "modifiedTime", title: "更新时间", width: "11%"},
                        {
                            title: "操作", width: "5%",
                            templet: function (data) {
                                return "<button class=\"layui-btn layui-btn-sm\" onclick='rollBack(" + data.customerInfId + ")' lay-event=\"delete\">还原</button>"
                            }
                        },
                    ]
                ]
            });

            table.on('checkbox(member-del-list-filter)', function (obj) {
                if (obj.checked) {
                    memberIds.push(obj.data.customerInfId);
                } else {
                    for (var i = 0; i < memberIds.length; i++) {
                        if (obj.data.customerInfId == memberIds[i]) {
                            memberIds.splice(i, 1);
                        }
                    }
                }
            });

            //监听事件
            table.on('toolbar(member-del-list-filter)', function (obj) {
                switch (obj.event) {
                    case 'delete':
                        del();
                        break;
                }
            });

        });
    });

    function del() {
        var index = layer.confirm('确认删除？', {
            btn: ['确认', '取消'], //按钮
            end: function () {
                memberIds = [];
                tableId.reload();
            }
        }, function () {
            $.ajax({
                url: "/Olala/client/customer/delCustomerInfoByIdsTrue",
                data: {
                    ids: memberIds
                },
                traditional: true,
                dataType: "json",
                type: "post",
                success: function (result) {
                    layer.msg(result.msg);
                    layer.close(index);
                }
            });
        }, function () {
            layer.close(index);
        });
    }

    function rollBack(id) {
        var index = layer.confirm('确认还原？', {
            btn: ['确认', '取消'], //按钮
            end: function () {
                tableId.reload();
            }
        }, function () {
            $.post("/Olala/client/customer/delRollBack", {customerInfId: id}, function (result) {
                layer.msg(result.msg);
            }, "json");
        }, function () {
            layer.close(index);
        });
    }
</script>
</body>
</html>